using System;
using System.Data;
using System.Collections;

namespace APP.QUANLY.Entity
{
    /// <summary>
    /// Summary description for NHANVIEN.
    /// </summary>
    public class NHANVIENList : CollectionBase
    {
		private string _ErrMsg;
        public string ErrMsg { get { return _ErrMsg; } }
    	public NHANVIENList()
    	{
	    }

		public void Add(NHANVIEN entity)
		{
            this.List.Add(entity);
		}

		public void Add(NHANVIENList list)
		{	
			foreach(NHANVIEN entity in list)
			{
				this.Add(entity);
			}
		}
	
		public new virtual Enumerator GetEnumerator()
		{
		    return new Enumerator(this);
		}
		public virtual NHANVIEN this[int index]
		{
		    get
			{
				return (NHANVIEN)this.List[index];
			}
			set
			{
				this.List[index] = value;
			}
		}

		#region Find Object And List Object
		//---PrimaryKey
	public virtual NHANVIEN Find(Int32 MANHANVIEN)
	{
	    foreach (NHANVIEN obj in this.List)
	    {
		if(obj.MANHANVIEN.ToString().ToUpper().Trim() == MANHANVIEN.ToString().ToUpper().Trim())
		{
		    obj.IsExisting = true;
		    return obj;
		}
	    }
	    return null;
	}

public virtual NHANVIENList FindListByMANHANVIEN(Int32 MANHANVIEN)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
		    if(obj.MANHANVIEN.ToString().ToUpper().Trim() == MANHANVIEN.ToString().ToUpper().Trim())
		    {
				List.Add(obj);
		    }
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
    	{
		_ErrMsg = ex.Message;
        		return null;
    	}
}
		//---NonPrimaryKey
        public virtual NHANVIEN FindByMALOAI(Int32 MALOAI)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.MALOAI.ToString().ToUpper().Trim() == MALOAI.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByTENNHANVIEN(string TENNHANVIEN)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.TENNHANVIEN.ToString().ToUpper().Trim() == TENNHANVIEN.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByCHUCVU(string CHUCVU)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.CHUCVU.ToString().ToUpper().Trim() == CHUCVU.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByNGAYSINH(DateTime NGAYSINH)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.NGAYSINH.ToString().ToUpper().Trim() == NGAYSINH.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByGIOITINH(string GIOITINH)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.GIOITINH.ToString().ToUpper().Trim() == GIOITINH.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByCMND(string CMND)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.CMND.ToString().ToUpper().Trim() == CMND.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByDIACHI(string DIACHI)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.DIACHI.ToString().ToUpper().Trim() == DIACHI.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByQUEQUAN(string QUEQUAN)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.QUEQUAN.ToString().ToUpper().Trim() == QUEQUAN.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByDIDONG(string DIDONG)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.DIDONG.ToString().ToUpper().Trim() == DIDONG.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByLUONGCOBAN(decimal LUONGCOBAN)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.LUONGCOBAN.ToString().ToUpper().Trim() == LUONGCOBAN.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByEMAIL(string EMAIL)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.EMAIL.ToString().ToUpper().Trim() == EMAIL.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByTHEODOI(bool THEODOI)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.THEODOI.ToString().ToUpper().Trim() == THEODOI.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByNGAYTAO(DateTime NGAYTAO)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.NGAYTAO.ToString().ToUpper().Trim() == NGAYTAO.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByNGUOITAO(string NGUOITAO)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.NGUOITAO.ToString().ToUpper().Trim() == NGUOITAO.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByNGAYCAPNHAT(DateTime NGAYCAPNHAT)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.NGAYCAPNHAT.ToString().ToUpper().Trim() == NGAYCAPNHAT.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByNGUOICAPNHAT(string NGUOICAPNHAT)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.NGUOICAPNHAT.ToString().ToUpper().Trim() == NGUOICAPNHAT.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHANVIEN FindByISDELETE(bool ISDELETE)
        {
	        foreach (NHANVIEN obj in this.List)
	        {
		        if(obj.ISDELETE.ToString().ToUpper().Trim() == ISDELETE.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

public virtual NHANVIENList FindListByMALOAI(Int32 MALOAI)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.MALOAI.ToString().ToUpper().Trim() == MALOAI.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByTENNHANVIEN(string TENNHANVIEN)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.TENNHANVIEN.ToString().ToUpper().Trim() == TENNHANVIEN.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByCHUCVU(string CHUCVU)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.CHUCVU.ToString().ToUpper().Trim() == CHUCVU.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByNGAYSINH(DateTime NGAYSINH)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.NGAYSINH.ToString().ToUpper().Trim() == NGAYSINH.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByGIOITINH(string GIOITINH)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.GIOITINH.ToString().ToUpper().Trim() == GIOITINH.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByCMND(string CMND)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.CMND.ToString().ToUpper().Trim() == CMND.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByDIACHI(string DIACHI)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.DIACHI.ToString().ToUpper().Trim() == DIACHI.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByQUEQUAN(string QUEQUAN)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.QUEQUAN.ToString().ToUpper().Trim() == QUEQUAN.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByDIDONG(string DIDONG)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.DIDONG.ToString().ToUpper().Trim() == DIDONG.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByLUONGCOBAN(decimal LUONGCOBAN)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.LUONGCOBAN.ToString().ToUpper().Trim() == LUONGCOBAN.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByEMAIL(string EMAIL)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.EMAIL.ToString().ToUpper().Trim() == EMAIL.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByTHEODOI(bool THEODOI)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.THEODOI.ToString().ToUpper().Trim() == THEODOI.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByNGAYTAO(DateTime NGAYTAO)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.NGAYTAO.ToString().ToUpper().Trim() == NGAYTAO.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByNGUOITAO(string NGUOITAO)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.NGUOITAO.ToString().ToUpper().Trim() == NGUOITAO.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByNGAYCAPNHAT(DateTime NGAYCAPNHAT)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.NGAYCAPNHAT.ToString().ToUpper().Trim() == NGAYCAPNHAT.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByNGUOICAPNHAT(string NGUOICAPNHAT)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.NGUOICAPNHAT.ToString().ToUpper().Trim() == NGUOICAPNHAT.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHANVIENList FindListByISDELETE(bool ISDELETE)
{
	try
	{
		NHANVIENList List = new NHANVIENList();
		foreach (NHANVIEN obj in this.List)
		{
			if(obj.ISDELETE.ToString().ToUpper().Trim() == ISDELETE.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}
		#endregion
     
		#region Inner Classes
		/// <summary>
		/// Type-specific enumeration class, used by LogCollection.GetEnumerator.
		/// </summary>
		public class Enumerator : IEnumerator
		{
			private IEnumerator wrapped;

			public Enumerator(NHANVIENList collection)
			{
				this.wrapped = ((CollectionBase)collection).GetEnumerator();
			}

			public NHANVIEN Current
			{
				get
				{
					return (NHANVIEN)(this.wrapped.Current);
				}
			}

			object IEnumerator.Current
			{
				get
				{
					return (NHANVIEN)(this.wrapped.Current);
				}
			}

			public bool MoveNext()
			{
				return this.wrapped.MoveNext();
			}

			public void Reset()
			{
				this.wrapped.Reset();
			}
      }
      #endregion  
   }
}